/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cse308.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aaron
 */
@Entity
@Table(catalog = "nchorn", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Surveyattainmentlevels.findAll", query = "SELECT s FROM Surveyattainmentlevels s"),
    @NamedQuery(name = "Surveyattainmentlevels.findBySurvey", query = "SELECT s FROM Surveyattainmentlevels s WHERE s.surveyattainmentlevelsPK.survey = :survey"),
    @NamedQuery(name = "Surveyattainmentlevels.findByPeo", query = "SELECT s FROM Surveyattainmentlevels s WHERE s.surveyattainmentlevelsPK.peo = :peo"),
    @NamedQuery(name = "Surveyattainmentlevels.findByAttinmentlevel", query = "SELECT s FROM Surveyattainmentlevels s WHERE s.attinmentlevel = :attinmentlevel")})
public class Surveyattainmentlevels implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SurveyattainmentlevelsPK surveyattainmentlevelsPK;
    private Integer attinmentlevel;
    @JoinColumn(name = "survey", referencedColumnName = "identifier", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Survey survey1;

    public Surveyattainmentlevels() {
    }

    public Surveyattainmentlevels(SurveyattainmentlevelsPK surveyattainmentlevelsPK) {
        this.surveyattainmentlevelsPK = surveyattainmentlevelsPK;
    }

    public Surveyattainmentlevels(int survey, String peo) {
        this.surveyattainmentlevelsPK = new SurveyattainmentlevelsPK(survey, peo);
    }

    public SurveyattainmentlevelsPK getSurveyattainmentlevelsPK() {
        return surveyattainmentlevelsPK;
    }

    public void setSurveyattainmentlevelsPK(SurveyattainmentlevelsPK surveyattainmentlevelsPK) {
        this.surveyattainmentlevelsPK = surveyattainmentlevelsPK;
    }

    public Integer getAttinmentlevel() {
        return attinmentlevel;
    }

    public void setAttinmentlevel(Integer attinmentlevel) {
        this.attinmentlevel = attinmentlevel;
    }

    public Survey getSurvey1() {
        return survey1;
    }

    public void setSurvey1(Survey survey1) {
        this.survey1 = survey1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (surveyattainmentlevelsPK != null ? surveyattainmentlevelsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Surveyattainmentlevels)) {
            return false;
        }
        Surveyattainmentlevels other = (Surveyattainmentlevels) object;
        if ((this.surveyattainmentlevelsPK == null && other.surveyattainmentlevelsPK != null) || (this.surveyattainmentlevelsPK != null && !this.surveyattainmentlevelsPK.equals(other.surveyattainmentlevelsPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cse308.entities.Surveyattainmentlevels[ surveyattainmentlevelsPK=" + surveyattainmentlevelsPK + " ]";
    }
    
}
